package nimble.unionpay.openapi;

import org.apache.commons.lang3.StringUtils;

public enum CardClass {

    RMB_DOMESTIC_CARD("01","人民币卡（境内发的人民币银联卡）"),
    RMB_OVERSEAS_CARD("02","人民币境外卡（境外发的人民币银联标准卡）"),
    MULTI_CURRENCY_CARD("03","多币种卡（境内和境外发的多币种银联标准卡）"),
    INTERNATIONAL_CARD("04","国际卡（境内发的外币银联标准卡）"),
    OVERSEAS_CARD("05","境外卡（境外发的外币银联标准卡）"),
    FOREIGN_CARD("06","外资卡（外资银行在境内发的银联标准卡）"),
    FOREIGN_INTERNATIONAL_CARD("07","外卡（5大国际组织）"),
    OTHER_CARD("99","其他");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    CardClass(String code, String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static CardClass parse(String code)
    {
        for(CardClass cardClass:CardClass.values())
        {
            if(StringUtils.equalsAny(code,cardClass.name(),cardClass.getCode()))
            {
                return cardClass;
            }
        }
        return null;
    }
}
